@import '@angular/material/theming';

.horizontal-list-wrapper {
  display: flex;
  align-items: center;
  width: 260px;
  background-color: #ffffff;
  border-radius: 4px;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid rgba(0, 0, 0, 0.23);
  position: relative;
  height: 36px;
  transition: border-color 0.2s ease-in-out;
  margin-top: 0 !important;

  &:hover {
    border-color: rgba(0, 0, 0, 0.87);
  }

  &:focus-within {
    border-color: #30708e;
    border-width: 2px;
  }
}

app-horizontal-item-list .horizontal-list-wrapper .scroll-button {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-shrink: 0;
  min-width: 24px;
  height: 24px;
  font-size: 16px;
  border-radius: 50%;
  background-color: transparent;
  color: rgba(0, 0, 0, 0.54);
  border: none;
  cursor: pointer;
  transition: color 0.2s ease-in-out;
  padding: 0;

  &:hover {
    background-color: rgba(0, 0, 0, 0.04);
    color: rgba(0, 0, 0, 0.87);
  }

  mat-icon {
    font-size: 16px;
    height: 16px;
    width: 16px;
    line-height: 16px;
  }
}

.horizontal-scroll-container {
  flex-grow: 1;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  height: 28px;
  border-radius: 4px;
  background-color: transparent;
  white-space: nowrap;
  display: flex;
  align-items: center;

  &::-webkit-scrollbar {
    display: none;
  }
  -ms-overflow-style: none;
  scrollbar-width: none;
}

:host ::ng-deep {
  .mat-mdc-chip {
    height: 30px;
    font-size: 13px;
    background-color: rgba(0, 0, 0, 0.08);
    color: rgba(0, 0, 0, 0.87);
    border-radius: 16px;
    margin: 2px 4px 2px 0;
    padding: 0 8px;

    &:hover {
      background-color: rgba(0, 0, 0, 0.12);
    }

    .mat-mdc-chip-remove {
      width: 16px;
      height: 16px;
      opacity: 0.54;

      &:hover {
        opacity: 0.87;
      }
    }
  }

  .chip-input {
    width: 100px;      // or any width you want
    height: 24px;
    font-size: 13px;
    padding: 0 4px;
    margin: 2px 0;
    border: none;
    background: transparent;
    outline: none;
    color: rgba(0, 0, 0, 0.87);

    &::placeholder {
      color: rgba(0, 0, 0, 0.38);
    }
  }

  .mat-mdc-standard-chip.mdc-evolution-chip--with-trailing-action .mdc-evolution-chip__action--primary {
    padding-left: 5px !important;
  }

  .mat-mdc-standard-chip.mdc-evolution-chip--with-trailing-action .mdc-evolution-chip__action--trailing {
    padding-right: 2px !important;
  }

  .mat-mdc-icon-button.mat-mdc-button-base {
    width: 38px !important;
    height: 38px !important;
    padding: 8px !important;
  }

  .mat-mdc-option.mdc-list-item--disabled {
    opacity: 1 !important;
    cursor: pointer !important;
    color: inherit !important;
    background: inherit !important;
  }
}

.left-scroll {
  margin-right: 0;
}

.right-scroll {
  margin-left: 0;
}

.flex-list {
  display: flex;
  padding: 0 4px; /* Reduced list padding */
  gap: 4px; /* Reduced gap between items */
  align-items: center;
  height: 100%;
}

.item-card {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 60px; /* Significantly reduced minimum width */
  height: 24px; /* Reduced item height */
  background-color: #e3f2fd;
  color: #30708e;
  border-radius: 4px;
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  cursor: grab;
  font-size: 0.75em; /* Further reduced font size */
  padding: 0 4px; /* Reduced padding */

  &:active {
    cursor: grabbing;
  }

  &:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
  }
}

.item-content {
  font-weight: 500;
}

.add-button {
  display: none; /* Hide the "Add Item" button as space is limited */
}

/* Responsive adjustments (might need further tweaking for very small screens) */
@media (max-width: 200px) {
  .horizontal-list-wrapper {
    width: 100%; /* Allow to take full width on very small screens */
  }
}

.outlined-field-container {
  position: relative;
  margin: 16px 0;
  display: inline-block;
}

.outlined-field-label {
  position: absolute;
  top: -10px;
  left: 12px;
  background: #fff;
  padding: 0 4px;
  font-size: 13px;
  color: rgba(0,0,0,0.6);
  z-index: 1;
  pointer-events: none;
  transition: color 0.2s;
}

.outlined-field-container:focus-within .outlined-field-label {
  color: #30708e;
}

.item-outline-field {
  position: relative;
  margin-top: 24px;
  width: 100%;
  max-width: 400px;
}

.plain-item-row {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  border: 1px solid rgba(0,0,0,0.38);
  border-radius: 4px;
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  min-width: 0;
  height: 40px;
  padding: 10px;
}

.plain-item-row:focus-within {
  border-color: #30708e;
  box-shadow: 0 0 0 2px rgba(63,81,181,0.15);
}

.item-outline-label {
  position: absolute;
  top: -12px;
  left: 16px;
  background: #fff;
  font-size: 13px;
  color: rgba(0,0,0,0.6);
  transition: color 0.2s;
  pointer-events: none;
  z-index: 1;
}

.plain-item-row:focus-within .item-outline-label {
  color: #30708e;
}

::ng-deep .cdk-overlay-pane .mat-mdc-autocomplete-panel {
  min-width: 250px !important;
  width: 250px !important;
}

::ng-deep .mat-mdc-option.mdc-list-item--disabled {
  opacity: 1 !important;
  cursor: pointer !important;
  color: inherit !important;
  background: inherit !important;
}

.all-options-toggle-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
